function getXmlHttpRequestObject() {
        if (window.XMLHttpRequest) {
                return new XMLHttpRequest();
        } else if (window.ActiveXObject) {
                return new ActiveXObject("Microsoft.XMLHTTP");
        } else {
                alert("IE5/6 not supported");
        }
}

var voteReq = getXmlHttpRequestObject();
var entryIdNum;
function castVote(entryId) {
	entryIdNum = entryId;
	 if (voteReq.readyState == 4 || voteReq.readyState == 0) {
		 voteReq.open("GET", '/vote?entryId='+entryId, true);	
		 voteReq.onreadystatechange = handleVote; 
		 voteReq.send(null);
	 }
}

function handleVote() {
	if (voteReq.readyState == 4) {
		document.getElementById('vote_count_'+entryIdNum).innerHTML = voteReq.responseText;
	}
}

function redrawElement(eleId) {
	var el = document.getElementById(eleId);
	el.style.display = 'none';
	el.style.display = 'block';
}
